import router from './router/index'
import store from './store/index'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { Message } from 'element-ui'

const whiteUrl = ['/', '/newPrj', '/404', '/403', '/500']

router.beforeEach((to, from, next) => {
  NProgress.start()
  next()
  // if (whiteUrl.indexOf(to.path) !== -1) {
  //   next()
  // } else if (store.getters.roles.length === 0) {
  //   store.dispatch('GetInfo').then(res => {
  //     next({ ...to })
  //     store.commit('SET_TOKEN', true)
  //   }).catch((error:any) => {
  //     console.log(error.response)
  //     store.dispatch('FedLogOut').then(() => {
  //       Message.error('验证失败，请重新登录')
  //     })
  //   })
  // } else {
  //   next()
  // }
})

router.afterEach(() => {
  NProgress.done()
})
